﻿int[] array = { 12, 33, 21, 34, 55, 6 };
for (int i = 0; i < array.Length - 1; i++)
{
    for (int j = 0; j < array.Length - i - 1; j++)
    {
        if (array[j] > array[j + 1])
        {
            int temp = array[j];
            array[j] = array[j + 1];
            array[j + 1] = temp;
        }
    }
}
//最大值
Console.WriteLine("最大值为：" + array[array.Length - 1]);
//最小值
Console.WriteLine("最小值为：" + array[0]);

//Console.WriteLine(array.Min());

            //Console.WriteLine(array.Max());
        
            //Console.WriteLine(array.Average());
       
            //Console.WriteLine(array.Sum());

            //总和
            double sum=0;
for (int i = 0; i < array.Length; i++)
{
    sum += array[i];
}
Console.Write("总和为：" + sum);
Console.WriteLine();

//平均值
double p = sum / (array.Length);
Console.Write("平均值为：" + p);
Console.WriteLine();

